<template>
  <div>
    <div class="loading-box" v-if="isLoading">
      <loading></loading>
    </div>
    <iframe @load="load" class="iframe" :src="url" v-show="!isLoading"></iframe>
  </div>
</template>
<script>
export default {
  name: 'iframe',
  computed: {
    url () {
      return this.$route.params.url
    }
  },
  data () {
    return {
      start: 0,
      isLoading: false
    }
  },
  created () {
    this.start = Date.now()
  },
  methods: {
    load () {
      console.log('iframe加载完成', `耗时: ${Date.now() - this.start}`)
    }
  }
}
</script>
<style lang="scss">
.iframe{
  width: 100vw;
  height: 100vh;
}
</style>